package gins

import (
	"fmt"
	"gitee.com/lailonghui/vehicle-supervision-framework/pkg/loggers"
	"gitee.com/lailonghui/vehicle-supervision-framework/pkg/results"
	"github.com/gin-gonic/gin"
)

// 操作成功
func Suc(ctx *gin.Context, data interface{}) {
	ctx.JSON(200, results.Suc(data))
}

// 操作失败
func Err(ctx *gin.Context, err error, statuscode int) {
	loggers.Error(fmt.Sprintf("%+v\n", err), ctx)
	ctx.JSON(statuscode, results.Err(err))
}
